package cn.com.wangluotongxin.common.eureka.constants;

import cn.hutool.core.util.StrUtil;

public enum SmsTemplate {

    UNIFY("1111111", "一醉梦七仙", "{%code%}为您的登录验证码，请于{%expireTime%}分钟内填写，如非本人操作，请忽略本短信。", 10);

    private String templateId;

    public String getTemplateId() {
        return templateId;
    }

    private String smsSign;

    public String getSmsSign() {
        return smsSign;
    }

    private String context;

    public String getContext() {
        return context;
    }

    private Integer expireTime;

    public Integer getExpireTime() {
        return expireTime;
    }

    public static SmsTemplate getByName(String name){
        if(StrUtil.isBlank(name)){
            return null;
        }else {
            SmsTemplate[] smsTemplates = values();
            for(SmsTemplate smsTemplate : smsTemplates){
                if(smsTemplate.name().equals(name)){
                    return smsTemplate;
                }
            }
        }
        return null;
    }

    SmsTemplate(String templateId, String smsSign, String context, Integer expireTime){
        this.templateId = templateId;
        this.smsSign = smsSign;
        this.context = context;
        this.expireTime = expireTime;
    }
}
